extends ../layout

block content
  nav.off-canvas-navigation.clearfix
          ul
            li.menu-item
              a.menu-button(href='#menu') 工作类别
            li.sidebar-item
              a.sidebar-button(href='#sidebar') 菜单
  nav#menu(role='navigation')
    .navwarper
      ul.cate-ul
        li 
          a(href="/")
            if active_category
              .nav-mark
            else
              .nav-mark.nav-mark-active
            |全部
        each category in category_array
          li 
            a(href="/category/#{ category.replace(/\//,'-') }")
              //.nav-mark-active
              if active_category == category.replace(/\//,'-')
                .nav-mark.nav-mark-active
              else
                .nav-mark
              | #{category}
        
  // Main Content

  section(role='main')
    //- h1 最新招聘信息
    .mainwarper

      ul.joblist-ul
        .jobfilter
          form(id="jobfilter", method="post", action="/")
            select(name="category" style="display:none;")
              option(value="#{ active_category?active_category.replace(/-/,'/') :''}") 
            ul
              li
                span 城市:
                .dropdown
                  select.dropdown-select(name="city")
                    each city in city_array
                      option(value="#{city}") #{city}
              li
                span 月薪范围:
                .dropdown
                  select.dropdown-select(name="salary")
                    each salary in salary_array
                      option(value="#{salary}") #{salary}
                span ￥
              li
                button.btn-sm.btn-cyan(type="submit" style="float:right") 过滤
        if !jobs || jobs.length == 0
          li
            h2 目前还没有招聘信息
        else
          each job in jobs 
            li
              h2 
                a(href="/job/#{job._id}") #{job.title}
              ul.joblist-detail
                li 
                  span #{job.city}
                li 公司:
                  span #{job.company}
                li 月薪:
                  span #{job.salary}
                li 发布日期:
                  span #{job._id.getTimestamp().yyyymmdd() }
        
        if totle_page > 1
          li
            ul.pagination
              -for(var i= 1;i<=totle_page;i++){
                li
                  if current_page == i-1
                    a.page_active(href="/#{active_category?'category/'+active_category:''}?page=#{i}") #{i}
                  else
                    a(href="/#{active_category?'category/'+active_category:''}?page=#{i}") #{i}
              -}
  // Aside Right
  section#sidebar(role='complementary')
    .right-sidebar
      .sidebar-header
        span 热门工作
      if hot_jobs && hot_jobs.length !== 0
        ul.cate-ul
          each hot_job in hot_jobs
            li(style="text-align:left;")
              a(href="/job/#{hot_job._id}") #{hot_job.title[0]}(#{hot_job.len})
      else
        p &nbsp;&nbsp;&nbsp;&nbsp;还没有热门工作
    .right-sidebar
      .sidebar-header
        span 在线会员
      ul.online-user-list
        if online_users.length != 0
          for user in online_users
            li
              img(src="http://www.gravatar.com/avatar/#{user.email_md5}.jpg", alt="#{user.username}")
              h4=user.username
        else
          li
            h4 当前无会员在线
        p(style="margin:0 0 10px 10px;") 正有#{visiter_nubmer}人在浏览本站。
